

                             The Disk Doctor


    The ST Disk Structure:

       sector 0 is the boot track
       sectors 1 through 5 are the first copy
           of the File Allocation Table (FAT)
       sectors 6 through 10 are the second FAT copy
       sectors 11 through 17 are the directory
       the remainder of the disk is data space.

         On floppies, the boot track is 1 sector long, each FAT is 5
    sectors, the directory is 7 sectors. On a single-sided disk, this
    theoretically leaves 702 sectors for data, but the operating
    system seems to count somewhat less: when a disk is formatted, it
    shows only 698 sectors available. Double-sided floppies also have
    1 sector boot tracks, On at least one hard disk, the boot track is
    again 1 sector long, each FAT is 41 sectors and the root directory
    (the main directory or desktop) is 16 sectors. Other hard disk
    structures may vary.


    DIRECTORY STRUCTURE

         The root or main directory is in the seven consecutive
    sectors mentioned above. A subdirectory (a folder or path) is
    actually a file on the disk. While the root directory is limited
    in the maximum number of files it can take, since files need not
    be contiguous, a subdirectory is not thus limited.


         Each directory entry is 32 bytes long: there are 16 entries
    per sector, laid out so:


         file name          bytes 0-7
         extension          bytes 8-10
         attributes         byte 11
         reserved space     bytes 12-21
         time stamp         bytes 22-23
         date stamp         bytes 24-25
         starting cluster   bytes 26-27 (an integer)
         length (bytes)     bytes 28-31 (a 4-byte integer)

         File name is the part of the name before the period, eight
    bytes padded on the right with blanks if less than that in length.
    If the first byte in a name is zero, the entry is unused. If $E5
    (229 decimal), then the file has been erased. If the first byte is
    a period, ($2E), then the entry is a special type of subdirectory.
    Extension is the remainder of the file name; three bytes, again
    padded with blanks. Reserved bytes are usually all zero.









                          Disk structure: Page 8




                             The Disk Doctor


         Attributes describe how the files are treated by the system.
    If the bit is zero, the attribute is off, if one it is on (used):


            bit 0 means the file is read only
            bit 1 means the file is hidden
            bit 2 means it is a system file
            bit 3 means it is a volume label, not a file
            bit 4 means it is a subdirectory
            bit 5 is an archive bit
            bits 6 and 7 are unused at present

         A read-only file cannot be written to or deleted. Hidden and
    system files are normally not seen in the directory listing but
    you can see these files by viewing the directory from the repair
    menu. The volume label is the disk name usually entered at format
    time. It normally only appears in the root directory.


         The subdirectory attribute says this is a folder (path)
    rather than a file, although they are stored in the same manner. A
    subdirectory is structured in the same manner as a root directory
    except that has no fixed size and can grow as large as necessary.


         The archive bit is set if a file has been changed since its
    last backup. Used normally only with hard disks. Attributes are
    marked on the disk information screen by a single letter. If an
    'x' appears below that letter, then the attribute is set.


         The time and date stamps record the last change of a file.


    time stamp:
            bits 0-4 are seconds/2 (0 - 29)
            bits 5-10 are minutes (0 - 59)
            bits 11-15 are hours (0 - 23)

    date stamp:
            bits 0-4 are the date (1-31)
            bits 5-8 are the month (1-12)
            bits 9-15 are the year (add 1980 to get the correct
    value)














                          Disk structure: Page 9




                             The Disk Doctor


         Starting cluster is an Intel 8088 format integer: that is,
    its bytes are swapped. That is, the low byte comes before the high
    byte. It is simply the cluster number where the file begins (there
    are two sectors in each cluster). For where the file goes after
    that, see the FAT. File Length is an Intel 8088 format longint:
    that is, its words are swapped and within each word, the bytes are
    swapped.


         File size contains the size on disk in bytes but the actual
    size in memory may be smaller if DOS reaches the last cluster in
    the FAT before this many bytes are read.














































                          Disk structure: Page 10


